var by_photoEnlargeService = (function(){
	var photoConfig = {
	 	'isScenePhotoShowed':false,
	 	'isOrderDoingPhotoShowed':false,
	 	'isFinishedOrderPhotoShowed':false,
	 
	 	'photoStatus':1,//1、不动 2、放大两倍 3、原图 
	 	'photoOriginWidth':0,
	 	'lastPhotoId':''
	 },
     enlarge = function(photoId){
        var $photo = $('#' + photoId);
        var width = $photo.width();
            if(photoId != photoConfig.lastPhotoId){
                if(photoConfig.lastPhotoId){
                    $('#' + photoConfig.lastPhotoId).width(photoConfig.photoOriginWidth);
                }
                photoConfig.photoStatus = 2;
                photoConfig.photoOriginWidth = width;
                photoConfig.photoClickUrl = $photo[0].src;
                photoConfig.lastPhotoId = photoId
            }else{
                photoConfig.photoStatus = photoConfig.photoStatus==3? 1: photoConfig.photoStatus+1;
            }
            switch(photoConfig.photoStatus){
                case 1:
                    $photo.width(photoConfig.photoOriginWidth);
                    break;
                case 2:
                    $photo.width(photoConfig.photoOriginWidth*2);
                    break;
                case 3:{
                    if(width < photoConfig.photoOriginWidth*2){
                        photoConfig.photoStatus = 1;
                        $photo.attr("style",photoConfig.photoOriginWidth);
                    }else{
                        $photo.removeAttr("style");
                    }
                    
                };
                break;
                default:$photo.width(photoConfig.photoOriginWidth);
            }
     };

 	return function(photoId){
        $('#'+photoId).bind('click', function() { 
            console.log('click'+photoId);
            enlarge(photoId);
        }); 
     };	
}($,window));
